//
//  BackPassword_ThreeViewController.m
//  O2O Product
//
//  Created by 特沃兹 on 2017/12/29.
//  Copyright © 2017年 Product Author. All rights reserved.
//

#import "BackPassword_ThreeViewController.h"

@interface BackPassword_ThreeViewController ()

@end

@implementation BackPassword_ThreeViewController

#pragma mark - ---------- Lazy Loading（懒加载） ----------
-(UILabel *)Label{
    if (_Label == nil) {
        _Label = [[UILabel alloc]init];
        _Label.text = @"请设置新的密码";
        _Label.textAlignment = NSTextAlignmentLeft;
        _Label.textColor = Color_333333;
    }
    return _Label;
}
-(TextFieldView *)PasswordText
{
    if (_PasswordText == nil) {
        _PasswordText = [[TextFieldView alloc]initWithFrame:CGRectMake(20, 50+TopBarHeight, Main_Screen_Width-40, 50)];
        _PasswordText.backgroundColor = [UIColor clearColor];
        _PasswordText.layer.borderWidth = 1;
        _PasswordText.layer.borderColor = [ChangeColor hexStringToColor:@"d2d2d2"].CGColor;
        [_PasswordText.leftIcon setImage:[UIImage imageNamed:@"Login_Pass"] forState:UIControlStateNormal];
        _PasswordText.placeholderString = @"请输入6-12位英文字符及数字";
        _PasswordText.maxTextLength = 12;
        _PasswordText.layer.cornerRadius = 2;
        _PasswordText.TextF.keyboardType = UIKeyboardTypePhonePad;
    }
    return _PasswordText;
}
-(UIButton *)CompleteButton{
    if (_CompleteButton == nil) {
        _CompleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_CompleteButton setBackgroundColor:Color_d73b3c];
        [_CompleteButton setTitle:@"完成" forState:UIControlStateNormal];
        [_CompleteButton setTitleColor:Color_ffffff forState:UIControlStateNormal];
        [_CompleteButton.layer setCornerRadius:2];
        [_CompleteButton addTarget:self action:@selector(CompleteAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _CompleteButton;
}
-(UIButton *)ContactButton{
    if (_ContactButton == nil) {
        _ContactButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_ContactButton setTitle:@"遇到问题？联系客服" forState:UIControlStateNormal];
        [_ContactButton setTitleColor:Color_999999 forState:UIControlStateNormal];
        [_ContactButton addTarget:self action:@selector(ContactAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _ContactButton;
}
#pragma mark - ----------   Lifecycle（生命周期） ----------
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor whiteColor]];

    
    [self InitSubView];

}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}
-(void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}
#pragma mark - ---------- Private Methods（私有方法） ----------

#pragma mark initliaze data(初始化数据)

#pragma mark config control（布局控件）
-(void)InitSubView{
    [self.view addSubview:self.Label];
    [self.Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_offset(0);
        make.top.mas_offset(TopBarHeight);
        make.size.mas_offset(CGSizeMake(Main_Screen_Width-40, 30));
    }];
    [self.view addSubview:self.PasswordText];
    [self.PasswordText mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_offset(0);
        make.top.equalTo(self.Label.mas_bottom).offset(25);
        make.size.mas_offset(CGSizeMake(Main_Screen_Width-40, 50));
    }];
    [self.view addSubview:self.CompleteButton];
    [self.CompleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_offset(0);
        make.top.equalTo(self.PasswordText.mas_bottom).offset(50);
        make.size.mas_offset(CGSizeMake(Main_Screen_Width-40, 50));
    }];
    [self.view addSubview:self.ContactButton];
    [self.ContactButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.CompleteButton.mas_bottom).offset(10);
        make.right.equalTo(self.CompleteButton.mas_right).offset(0);
        make.size.mas_offset(CGSizeMake(180, 40));
    }];
    //密码提示
    _passwordLabel = [[UILabel alloc]init];
    _passwordLabel.text = @"密码由6-12位字母.数字或半角符号组成，不能是10为以下纯数字";
    _passwordLabel.numberOfLines = 0;
    _passwordLabel.textColor = Color_999999;
    [self.view addSubview:_passwordLabel];
    [_passwordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.PasswordText.mas_bottom).offset(0);
        make.centerX.mas_offset(0);
        make.size.mas_offset(CGSizeMake(Main_Screen_Width-40, 45));
    }];
}
#pragma mark networkRequest (网络请求)



#pragma mark IBActions （点击事件xib）
-(void)ReturnViewAction{
    /*返回上一页*/
    
}
-(void)PasswordClearAction{
    /*可以明文查看已输入的密码*/
}
//完成
-(void)CompleteAction{
    /*
     1.密码为空的时候不可点击；
     2.校验密码，要求查看下方文字，错误飘字提示具体触犯了哪个规则；
     3.无误后跳转至登录页
     */
    UIViewController *vc = self.presentingViewController;
    while (vc.presentingViewController) {
        vc = vc.presentingViewController;
    }
    [vc dismissViewControllerAnimated:YES completion:NULL];

}
//联系客服
-(void)ContactAction{
    /*点击调用手机拨号功能并填充客户号码（后台配置）*/
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
